require(["config"], function() {
	require(["jquery", "ejs"], function($, ejs) {

		var loc = location.href;
		var n1 = loc.length; //地址的总长度
		var n2 = loc.indexOf("="); //取得=号的位置
		var prov_code = decodeURI(loc.substr(n2 + 1, n1 - n2)); //从=号后面的内容
		console.log(prov_code)
		
		const url = "/api/providers/find_by_prov_code";
		$.getJSON(url, {
			prov_code
		}, (data) => {
			if(data.res_code === 1) {
				console.log(data)
				const html = `<p><strong>供应商编码：</strong><span><%= prov_code %></span></p>
					<p><strong>供应商名称：</strong><span><%= prov_name %></span></p>
					<p><strong>联系人：</strong><span><%= linkman %></span></p>
					<p><strong>联系电话：</strong><span><%= telephone %></span></p>
					<p><strong>传真：</strong><span><%= fax %></span></p>
					<a href="providerList.html">返回</a>`;
				const ht = ejs.render(html, data.res_body.data);
				$(".providerView").html(ht);
			}
		});
	});
});